<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			var random = parseInt(Math.random() * 100 + 1);
			console.log(random);
			function guess() {
				var num = parseInt(document.getElementById("numId").value);
				var resultSpan = document.getElementById("resultId");
				
				if (isNaN(num)) {
					resultSpan.innerHTML = "请输入数字";
					return;
				}
				
				if (num > random) {
					resultSpan.innerHTML = "猜大了";
				} else if (num < random){
					resultSpan.innerHTML = "猜小了";
				} else {
					resultSpan.innerHTML = "猜对了";
				}
			}
		</script>
	</head>
	<body>
		<input type="text" id="numId"/>
		<button onclick="guess()">猜吧</button>
		<span id="resultId"></span>
	</body>
</html>
